import { Injectable } from '@angular/core';
import {HttpClient, HttpHeaders} from "@angular/common/http";
import {map, Observable} from "rxjs";

@Injectable({
  providedIn: 'root'
})

/**
 * 订单列表服务
 */
export class OrderService {
    private baseUrl = 'http://localhost:8080/manager';

    constructor(private http: HttpClient) {
    }

    getOrderVO(): Observable<any> {
        const url = `${this.baseUrl}/orders`;
        return this.http.get<any>(url);
    }

    updateOrderStatus(orderId: string | undefined, status: string | undefined) {
        const url = `${this.baseUrl}/update/order?orderid=${orderId}&orderstatus=${status}`;
        return this.http.get<any>(url);
    }

    deleteOrder(orderId: string | undefined) {
        const url = `${this.baseUrl}/delete/orderid=${orderId}`;
        return this.http.get<any>(url);
    }
}
